%%
%% This is file `listingsutf8.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% listingsutf8.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% This work consists of the main source file listingsutf8.dtx
%% and the derived files
%%    listingsutf8.sty, listingsutf8.pdf, listingsutf8.ins, listingsutf8.drv,
%%    listingsutf8-test1.tex, listingsutf8-test2.tex,
%%    listingsutf8-test3.tex, listingsutf8-test4.tex,
%%    listingsutf8-test5.tex.
%% 
\begingroup
  \catcode123 1 % {
  \catcode125 2 % }
  \def\x{\endgroup
    \expandafter\edef\csname lstU@AtEnd\endcsname{%
      \catcode35 \the\catcode35\relax
      \catcode64 \the\catcode64\relax
      \catcode123 \the\catcode123\relax
      \catcode125 \the\catcode125\relax
    }%
  }%
\x
\catcode35 6 % #
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\lstU@AtEnd{%
    \lstU@AtEnd
    \catcode#1 \the\catcode#1\relax
  }%
  \catcode#1 #2\relax
}
\TMP@EnsureCode{10}{12}% ^^J
\TMP@EnsureCode{33}{12}% !
\TMP@EnsureCode{36}{3}% $
\TMP@EnsureCode{38}{4}% &
\TMP@EnsureCode{39}{12}% '
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{43}{12}% +
\TMP@EnsureCode{44}{12}% ,
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{58}{12}% :
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{94}{7}% ^ (superscript)
\TMP@EnsureCode{95}{8}% _ (subscript)
\TMP@EnsureCode{96}{12}% `
\TMP@EnsureCode{124}{12}% |
\TMP@EnsureCode{126}{13}% ~ (active)
\g@addto@macro\lstU@AtEnd{\endinput}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{listingsutf8}%
  [2007/11/11 v1.1 Adding support for UTF-8 to listings (HO)]
\DeclareOption*{%
  \PassOptionsToPackage\CurrentOption{listings}%
}
\ProcessOptions*
\RequirePackage{listings}[2002/04/01]
\AtBeginDocument{%
  \@ifundefined{inputencoding}{%
    \RequirePackage{inputenc}%
  }{}%
}
\RequirePackage{pdftexcmds}[2007/11/11]
\def\lstU@temp#1#2{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname #1\endcsname\relax
    \PackageWarningNoLine{listingsutf8}{%
      Package loading is aborted because of missing %
      \@backslashchar#1.\MessageBreak
      #2%
    }%
    \expandafter\lstU@AtEnd
  \fi
}
\lstU@temp{scantokens}{It is provided by e-TeX}
\lstU@temp{pdf@unescapehex}{It is provided by pdfTeX >= 1.30}
\lstU@temp{pdf@filedump}{It is provided by pdfTeX >= 1.30}
\lstU@temp{pdf@filesize}{It is provided by pdfTeX >= 1.30}
\RequirePackage{stringenc}[2007/10/22]
\newif\iflstU@utfviii
\def\lstU@inputenc#1{%
  \expandafter\lstU@@inputenc#1utf8/utf8/\@nil
}
\def\lstU@@inputenc#1utf8/#2utf8/#3\@nil{%
  \ifx\\#1\\%
    \lstU@utfviiitrue
    \def\lst@inputenc{#2}%
  \else
    \lstU@utfviiifalse
  \fi
}
\lst@Key{inputencoding}\relax{%
  \def\lst@inputenc{#1}%
  \lstU@inputenc{#1}%
}
\def\lstU@input#1{%
  \iflstU@utfviii
    \edef\lstU@text{%
      \pdf@unescapehex{%
        \pdf@filedump{0}{\pdf@filesize{#1}}{#1}%
      }%
    }%
    \StringEncodingConvert\lstU@text\lstU@text{utf8}\lst@inputenc
    \def\lstU@temp{%
      \scantokens\expandafter{\lstU@text}%
    }%
  \else
    \def\lstU@temp{%
      \input{#1}%
    }%
  \fi
  \lstU@temp
}
\def\lstU@temp#1\def\lst@next#2#3\@nil{%
  \def\lst@InputListing##1{%
    #1%
    \def\lst@next{\lstU@input{##1}}%
    #3%
  }%
}
\expandafter\lstU@temp\lst@InputListing{#1}\@nil
\lstU@AtEnd
\endinput
%%
%% End of file `listingsutf8.sty'.
